/* ******************************************************************
 * This file is part of the escal project and distributed under the
 * terms of the GNU General Public License Version 3
 * Copyright (C) 2008 Epocher (xijiaosdq@gmail.com)
 * See COPYING file for licensing information.
 *******************************************************************/

#ifndef _EGEAR_APPLICATION_H_
#define _EGEAR_APPLICATION_H_

#include <QObject>
#include <QApplication>


class ClientWatcher;
class UploadServer;
class QTcpServer;
class UploadLinkManager;
class EgearApplication:public QApplication{
	Q_OBJECT
public:
	EgearApplication(int& argc, char* argv[], QObject *parent=0);
	~EgearApplication();
	bool initDaemon(int argc, char *argv[]);
	bool initFolders(int argc, char *argv[]);
	bool initSettings();
	bool initRuntime();

signals:
	void geturl(const QString &urlStr);
	void passUrl(const QString &urlStr);
	void quit();
public slots:
	void getUrlSlot(const QString &urlStr);
	void unInit();
	void getNewControlConnection();
	void clientQuited(ClientWatcher *client);
private:
	QList<ClientWatcher*> clientList;
	QTcpServer *server; // for local control
	UploadServer *upload_server; // for remote service
};
#endif /* _EGEAR_APPLICATION_H_ */
